import React from 'react';
import { getTempInfo } from '@/services/attendance/attendance';

const useTemplateInfo = query => {
    const [data, setData] = React.useState([]);
    const [loading, setLoading] = React.useState(true);

    React.useEffect(() => {
        const fetchData = async () => {
            setLoading(true);
            const result = await getTempInfo(query);
            if (result.code === 10000) {
                setData(result.data);
            }
            setLoading(false);
        };
        fetchData();
    }, []);

    return [loading, data];
};

export default useTemplateInfo;
